package com.yaoq.singleton;

/**
 * @ClassName DoubleCheckSingleton
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/9/1 17:58
 * @Version 1.0
 */
public class DoubleCheckSingleton {
    private static volatile DoubleCheckSingleton instance;

    public DoubleCheckSingleton() {
    }

    public static synchronized DoubleCheckSingleton getInstance() {
        if (instance == null) {
            synchronized (DoubleCheckSingleton.class) {
                if (instance == null) {
                    instance = new DoubleCheckSingleton();
                }
            }
        }
        return instance;
    }
}
